package nsn.message.aggregator.wizzards;

import java.util.Map;

import nsn.message.aggregator.model.ISourceType;

import org.eclipse.jface.wizard.Wizard;

/**
 * 
 * @author Lukasz Nowak
 * @since 10-03-2011
 * 
 */
public class NewSourceWizard extends Wizard {
	private final ISourceType _sourceType;
	private Map<String, String> _values;
	private NewSourcePage newSourcePage;

	/**
	 * 
	 * 
	 * @param sourceType
	 */
	public NewSourceWizard(final ISourceType sourceType) {
		_sourceType = sourceType;
	}

	@Override
	public void addPages() {
		addPage(getNewSourcePage());

	}
	/**
	 * 
	 * 
	 * @return Map<String, String>
	 */
	public Map<String, String> getValues() {
		return _values;
	}

	@Override
	public boolean performFinish() {
		_values = getNewSourcePage().getValues();
		return _values != null;
	}

	private NewSourcePage getNewSourcePage() {
		if (newSourcePage == null) {
			newSourcePage = new NewSourcePage(_sourceType);
		}
		return newSourcePage;
	}

}
